{% extends "manager/base.html" %}

{% block content %}
<div class="container mt-4">
    <h2>{{ title }}</h2>
    <form method="post">
        {% csrf_token %}
        <div class="form-group row mb-3">
            <label class="col-sm-2 col-form-label">{{ form.username.label }}</label>
            <div class="col-sm-10">
                {{ form.username }}
                {% if form.username.errors %}
                    <div class="text-danger">{{ form.username.errors }}</div>
                {% endif %}
            </div>
        </div>
        <div class="form-group row mb-3">
            <label class="col-sm-2 col-form-label">{{ form.password.label }}</label>
            <div class="col-sm-10">
                {{ form.password }}
                {% if form.password.help_text %}
                    <small class="form-text text-muted">{{ form.password.help_text }}</small>
                {% endif %}
                {% if form.password.errors %}
                    <div class="text-danger">{{ form.password.errors }}</div>
                {% endif %}
            </div>
        </div>
        <div class="form-group row mb-3">
            <label class="col-sm-2 col-form-label">{{ form.user_type.label }}</label>
            <div class="col-sm-10">
                {{ form.user_type }}
                {% if form.user_type.errors %}
                    <div class="text-danger">{{ form.user_type.errors }}</div>
                {% endif %}
            </div>
        </div>
        <div class="form-group row mb-3">
            <label class="col-sm-2 col-form-label">{{ form.createTime.label }}</label>
            <div class="col-sm-10">
                {{ form.createTime }}
                {% if form.createTime.errors %}
                    <div class="text-danger">{{ form.createTime.errors }}</div>
                {% endif %}
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-10 offset-sm-2">
                <button type="submit" class="btn btn-primary">
                    <i class="bi bi-save"></i> 保存
                </button>
                <a href="{% url 'user_list' %}" class="btn btn-secondary">
                    <i class="bi bi-x-circle"></i> 取消
                </a>
            </div>
        </div>
    </form>
</div>
{% endblock %}